//
//  KeyboardViewController.m
//  CocoaSynth
//
//  Created by Thomas Dupont on 17/02/10.
//  Copyright 2010 Apple Inc. All rights reserved.
//

#import "KeyboardViewController.h"

#import "ModuleKeyboardViewController.h"
#import "KeyboardButtonController.h"

#define kDOFrequency	261.6
#define kDOdFrequency	277.2
#define kREFrequency	293.7
#define kREdFrequency	311.1
#define	kMIFrequency	329.7
#define kFAFrequency	349.2
#define kFAdFrequency	370.0
#define kSOLFrequency	392.0
#define kSOLdFrequency	415.3
#define kLAFrequency	440
#define kLAdFrequency	466.2
#define	kSIFrequency	493.9

@implementation KeyboardViewController

@synthesize module, noteDO, noteDOd, noteRE, noteREd, noteMI, noteFA, noteFAd, noteSOL, noteSOLd, noteLA, noteLAd, noteSI;

- (id)init
{
	if (self = [super init]) {
		
	}
	
	return self;
}

- (void)awakeFromNib 
{
	[noteDO setNoteFrequency:kDOFrequency];
	[noteDOd setNoteFrequency:kDOdFrequency];
	[noteRE setNoteFrequency:kREFrequency];
	[noteREd setNoteFrequency:kREdFrequency];
	[noteMI setNoteFrequency:kMIFrequency];
	[noteFA setNoteFrequency:kFAFrequency];
	[noteFAd setNoteFrequency:kFAdFrequency];
	[noteSOL setNoteFrequency:kSOLFrequency];
	[noteSOLd setNoteFrequency:kSOLdFrequency];
	[noteLA setNoteFrequency:kLAFrequency];
	[noteLAd setNoteFrequency:kLAdFrequency];
	[noteSI setNoteFrequency:kSIFrequency];
	
	[noteDO setKeyboardViewController:self];
	[noteDOd setKeyboardViewController:self];
	[noteRE setKeyboardViewController:self];
	[noteREd setKeyboardViewController:self];
	[noteMI setKeyboardViewController:self];
	[noteFA setKeyboardViewController:self];
	[noteFAd setKeyboardViewController:self];
	[noteSOL setKeyboardViewController:self];
	[noteSOLd setKeyboardViewController:self];
	[noteLA setKeyboardViewController:self];
	[noteLAd setKeyboardViewController:self];
	[noteSI setKeyboardViewController:self];
}

- (void)notePlayed:(float)theNote
{
	NSLog(@"ccccccccouuuuuuuccccccccoou %f", theNote);
	[module setVoltage:theNote];
}

@end
